package com.baitap.Module;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.function.IntConsumer;

import javax.swing.UIManager;


public class PhepTinh {
	public PhepTinh(){
		intPhepTinh();
	}
	private void intPhepTinh(){
		//Tao Gui instance va EventProcessor instance
		ptGUI gui = new ptGUI();
		EvtProcessor evtProcessor = new EvtProcessor(gui);
		// Khoi tao GUI
		gui.intGUI(evtProcessor);
		gui.validate();
		
		
		gui.setSize(new Dimension(400, 400));
		gui.setTitle("AQ Calculator");
		
		
		// Cho hien thi o giua man hinh
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension frameSize = gui.getSize();
		if (frameSize.height > screenSize.height) {
			frameSize.height = screenSize.height;			
		}
		if (frameSize.width > screenSize.width) {
			frameSize.width = screenSize.width;
		}
		gui.setLocation((screenSize.width-frameSize.width)/2, (screenSize.height - frameSize.height)/2);
		gui.setVisible(true);
		}
	

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		new PhepTinh();

	}

}
